package org.ns.learn.rpc.client.rpcinterface;

/**
 * Rpc 应答记录
 */
public class RpcResponseRecode {

    private String clientName; // xxx.xxx.xxx.xxx:MMMM
    private long requestTime;
    private long responseTime;

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public long getRequestTime() {
        return requestTime;
    }

    public void setRequestTime(long requestTime) {
        this.requestTime = requestTime;
    }

    public long getResponseTime() {
        return responseTime;
    }

    public void setResponseTime(long responseTime) {
        this.responseTime = responseTime;
    }

    public long getElapsedTime() {
        return this.responseTime - this.requestTime;
    }

    public boolean isTimeout(long timeout) {
        return System.currentTimeMillis() - responseTime > timeout;
    }
}
